﻿
using System.Collections.Generic;
using System.Data;
using System;
namespace ZHDJ.MobileInterface
{
    public partial class GetPartyPhotoTypeList : AbstractBasePage
    {
        protected override OutParam BusinessProcess<InParam, OutParam>(InParam inParam)
        {
            // 业务逻辑返回的响应对象  
            PartyPhotoTypeOutParam result = new PartyPhotoTypeOutParam();
            PartyPhotoTypeInParam param = new PartyPhotoTypeInParam();
            string logMsg = "";
            bool isFlag = true;
                 
            try
            {
                param = inParam as PartyPhotoTypeInParam; 

                if(isFlag)
                {
                    PartyPhotoType itemTemp;
                    DataSet ds = InterfaceHelper.GetPartyPhotoTypeList();
                    //itemTemp = new PartyPhotoType();
                    //itemTemp.name = "群众路线教育实践";
                    //itemTemp.type_id = "群众路线教育实践";
                    //result.data.list.Add(itemTemp); 
                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    { 
                        foreach(DataRow dr in ds.Tables[0].Rows)
                        {
                            itemTemp = new PartyPhotoType();
                            itemTemp.name = dr["name"].ToString();
                            itemTemp.type_id = dr["type_id"].ToString(); 
                            result.data.list.Add(itemTemp);
                        }
                    }
                }
                logMsg = result.desc;
            }
            catch (Exception ex)
            {
                result.code = "0";
                result.desc = "操作异常，多次出现请联系管理员"; 
                logMsg = ex.Message + ":" + ex.StackTrace;
            }

            CommonUtils.InsertMobileInterfaceLog(SystemCode +"-GetPartyPhotoTypeList", SerializeHelper.JsonSerializer<PartyPhotoTypeInParam>(param), logMsg); 
            return result as OutParam;
        }

        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (string.Compare(Request.QueryString["Safe"], "False", true) == 0)
                ProcessRequest<PartyPhotoTypeInParam, PartyPhotoTypeOutParam>();
            else
                SafeProcessRequest<PartyPhotoTypeInParam, PartyPhotoTypeOutParam>();
        }
    }

    #region 请求参数
    public class PartyPhotoTypeInParam
    { 
    }
    #endregion

    #region 结果参数
    public class PartyPhotoTypeOutParam
    {
        public PartyPhotoTypeOutParam()
        {
            code = "1";
            desc = "操作成功";
            data = new PartyPhotoTypeList();
        }

        /// <summary>
        /// 返回结果 具体见接口返回对照码 1	成功 0	失败 2	请求非法 加密结果和传入的MD5字符串进行比较，如果相同则执行接口操作，否则返回1001错误响应码
        /// </summary>
        public string code
        { get; set; }

        /// <summary>
        /// 结果描述 成功和失败都需要
        /// </summary>
        public string desc
        { get; set; }

        /// <summary>
        /// 留影墙照片类别列表
        /// </summary>
        public PartyPhotoTypeList data
        { get; set; }
    }

    public class PartyPhotoTypeList
    {
        public PartyPhotoTypeList()
        { 
            list = new List<PartyPhotoType>();
        }

        public List<PartyPhotoType> list { get; set; } 
    }
     
    /// <summary>
    /// 留影墙照片类别
    /// </summary>
    public class PartyPhotoType
    { 
        /// <summary>
        ///	类型ＩＤ
        /// </summary>
        public string type_id
        { get; set; }

        /// <summary>
        ///	类型名称
        /// </summary>
        public string name
        { get; set; } 
    }
    #endregion 
}